let rawObj = {
  "and": {
    "event_id": 100010003,
    "event_name": "网络中出现口令明文",
    "src.device_sec_domain": {
      "in": ["YH"],
      "_": "设备安全域,源地址设备安全用户域,list,str"
    },
    "e_session_password_isplain": {
      "ranges": {
        "lt": 8,
        "gt": 1
      },
      "_": "设备范围,设备范围描述,num"
    },
    "e_action_result": {
      "eq": 0,
      "_": "行为结果,,num"
    },
    "or": {
      "src.device_id": {
        "eq": null
      },
      "c_dst_ip": {
        "in": ["192.168.5.6"],
        "_": "目的地址,外联ip地址列表,list,str"
      },
      "e_log_type": {
        "eq": "/warn/outreach"
      }
    },
    "protocol": {
      "in": [5, 6, 11, 40],
      "_": "应用层协议,远程登录协议列表,list,num"
    },
    "e_application_app_protocol": {
      "IN": [
        {
          "lte": 0
        },
        {
          "eq": 54
        },
        {
          "range": {
            "lt": 50020,
            "gt": 50010
          }
        }
      ],
      "_": "应用层协议,协议黑名单,list,num"
    }
  }
}
function isObject (data) {
  return Object.prototype.toString.call(data) === '[object Object]'
}
function isArray (data) {
  return Object.prototype.toString.call(data) === '[object Array]'
}
let result = {}

for (let key in rawObj) {
  if (isObject(rawObj[key])) {
    for (let ele in rawObj[key]) {
      if (isObject(rawObj[key][ele])) {
        recursive(ele, rawObj[key][ele])
      }
    }
  }
}

function recursive(ele, curObj) {
  if ((Object.keys(curObj).includes('_'))) {
    let key = new Date().getTime() + Math.floor(Math.random() * 100)
    let resObject = { field: ele, op: '', value: null, name: '', desc: '', types: [] }
    for (let i in curObj) {
      if (i === '_') {
        [resObject.name, resObject.desc, resObject.types] = curObj[i].split(',')
      } else {
        resObject.op = i
        resObject.value = curObj
      }
    }
    result[key] = resObject
  } else {
    for (let j in curObj) {
      if (isObject(curObj[j])) {
        recursive(j, curObj[j])
      }
    }
  }
}


for (let i in result) {
  for (let j in result[i].value) {
    if (j !== '_') {
      if (isArray(result[i].value[j])) {
        let res = result[i].value[j].every(item => isObject(item))
        // 数组中的值不为对象
        if (!res) {
          let str = (result[i].value[j]).join(',') // 数组切割为字符串
          result[i].value[j] = str
        }
      }
    }
  }
}
console.log(result)
console.log(rawObj) // 对象的引用关系